package com.li.druid.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;

/**
 * 继承mybatisplus提供的公共dao接口新增分页辅助默认实现
 * @param <T> 指定实体类型
 */
public interface IBaseMapper<T> extends BaseMapper<T>{
    /**
     *
     * @param pageNo
     * @param pageSize
     * @param queryWrapper 组件提供的查询辅助类
     * @return
     */
    default public IPage<T> selectPage(Integer pageNo, Integer pageSize, Wrapper<T> queryWrapper){
        IPage<T> page = new Page<>();
        page.setSize(pageSize);
        page.setCurrent(pageNo);
        // 执行分页查询
        return selectPage(page,queryWrapper);
    }
}
